package com.example.webflux.webflux.demo1;
/**
 *@Deacription TODO
 *@Author baohuajie
 *@Date 2020/12/30 18:01
 *@Version 1.0
 **/
public class Main {

    public static void main(String[] args) {
        Person person1 = new Person(1);
        Person person2 = new Person(2);
        Person person3 = new Person(3);

        // 内部类方式
        AddAge addAge = new AddAge() {
            @Override
            public Integer addAge(Person p1, Person p2) {
                return p1.getId() + p2.getId();
            }
        };

        Integer integer = addAge.addAge(person1, person2);
        System.out.println(integer);

        // lamda表达式
        AddAge addAge1 = (Person p1, Person p2) -> { return p1.getId() + p2.getId();};
        Integer integer1 = addAge1.addAge(person1, person2);
        System.out.println(integer1);

        // 方法引用
        AddAge addAge2 = OptClass::addAge;
        Integer integer2 = addAge.addAge(person1, person2);

        System.out.println(integer2);

    }



}
